package com.client.service.impl;

import com.client.service.FlowerTypesService;
import com.client.pojo.FlowerGoods;
import com.client.pojo.FlowerTypes;
import com.client.mapper.FlowerTypesMapper;
import com.client.service.FlowerGoodsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 晚云
 * @since 2023-09-14
 */
@Service
public class FlowerTypesServiceImpl extends ServiceImpl<FlowerTypesMapper, FlowerTypes> implements FlowerTypesService {

    @Autowired
    private FlowerTypesMapper flowerTypesMapper;

    @Autowired
    private FlowerGoodsService flowerGoodsService;
    /**
     * 查询一个类型的鲜花
     *
     * @param typeId
     * @return
     */
    @Override
    public List<String> select_list(Integer typeId) {
        List<String> list = flowerTypesMapper.select_id_list(typeId);
        return list;
    }

    /**
     * 查询不同类型的商品
     *
     * @param typeId
     * @return
     */
    @Override
    public List<FlowerGoods> query_List(int typeId) {
        List<String> list = flowerTypesMapper.typeById(typeId);
        if (!list.isEmpty()){
            List<FlowerGoods> flowerGoods = flowerGoodsService.type_list(list);
            return flowerGoods;
        }
        return null;
    }
}
